import { PORT1 } from "@/api/config/servicePort";

import http from "@/api";
import {ResultData} from "@/api/interface";
import {MenuAddForm, MenuForm} from "@/api/interface/menu";
import {TreeKey} from "element-plus/es/components/tree/src/tree.type";

/**
 * @name 菜单管理模块
 */
// * 获取用户列表
export const getMenuList = (keywords: string) => {
	return http.get<ResultData>(PORT1 + `/Menu/index`, {
		keywords: keywords
	});
};

export const editMenu = (menuInfo: MenuForm) => {
	return http.post<ResultData>(PORT1 + `/Menu/edit`, menuInfo);
}

export const deleteMenu = (ids: Array<TreeKey>) => {
	return http.get<ResultData>(PORT1 + `/Menu/del`, {
		id: ids
	});
}

export const addMenu = (menuInfo: MenuAddForm) => {
	return http.post<ResultData>(PORT1 + `/Menu/add`, menuInfo);
}
